package com.nantian.nfcm.bms.loan.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.nantian.nfcm.bms.loan.entity.LoanFiles;
import org.springframework.stereotype.Repository;

@Repository
public interface LoanFilesDao extends JpaRepository<LoanFiles, Long>, JpaSpecificationExecutor<LoanFiles> {
	
	/**
	 * 根据贷款业务类型查询对应的纸质资料信息
	 * @param businessType
	 * @return
	 */
	@Query("from LoanFiles lf where lf.businessType=?1 and lf.businessSubType is null")
	public LoanFiles findByBusinessType(String businessType);
	
	/**
	 * 根据子业务类型和业务类型进行查询
	 * @param businessType
	 * @param businessSubType
	 * @return
	 */
	@Query("from LoanFiles lf where lf.businessType=?1 and lf.businessSubType=?2")
	public LoanFiles findByBusinessTypeAndSubtype(String businessType, String businessSubType);
}
